/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dialog;

import main.Demo;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JDialog;

/**
 *
 * @author phat10130059
 */
public class RunBlockWindowDialog extends JDialog {

    public Demo jFrame;
    public RunBlockWindow runBlockWindow;

    public RunBlockWindowDialog(Demo demo) {

        this.jFrame = demo;

        setTitle("Running");

        runBlockWindow = new RunBlockWindow(this, this.jFrame);
        runBlockWindow.isRunning = true;
        
        add(runBlockWindow);
        setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        setModalityType(ModalityType.APPLICATION_MODAL);
        setResizable(false);
        setSize(400, 200);

        this.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosed(WindowEvent e) {
            }

            @Override
            public void windowClosing(WindowEvent e) {
                runBlockWindow.isRunning = false;
//                jFrame.setVisible(true);
                
//                demo.setVisible(true);
            }
        });
        
//        this.jFrame.setVisible(false);

    }
}
